<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>分析页面form表单</title>
</head>
<body>
	转换地址 http://www.utilities-online.info/xmltojson/#.UZM0qaJNtFU
	<div class="container">
	</div>
	<script type="text/javascript" src="/js/jquery.min.js"></script>
	<script type="text/javascript" src="/js/service.js"></script>
	<script type="text/javascript" src="/js/country.js"></script>
	<script type="text/javascript">
		function isArray(value){
			if(value == undefined){
				return false;
			}
			if (value instanceof Array ||
					(!(value instanceof Object) &&
					(Object.prototype.toString.call((value)) == '[object Array]') ||
					typeof value.length == 'number' &&
					typeof value.splice != 'undefined' &&
					typeof value.propertyIsEnumerable != 'undefined' &&
					!value.propertyIsEnumerable('splice'))) {
					return true;
			}
			return false;
		}
		$(document).ready(function(){
			var counties = data.serviceproviders.country;
			
			for(var i = 0;i<counties.length;i++){
				var ct = country[counties[i]["-code"].toUpperCase()];
				
				var provideres = counties[i].provider;
				if(!isArray(provideres)){
					provideres = new Array(provideres);
				}
				
				for(var j=0;j<provideres.length;j++){
					if(!!!provideres[j]){
						continue;
					}
					
					var pnm = provideres[j].name;
					if(isArray(pnm)){
						pnm = pnm[0];
					}
					
					var gsm = provideres[j].gsm;
					if(!!!gsm){
						continue;
					}
					
					var apns = gsm["apn"];
					if(!isArray(apns)){
						apns = new Array(apns);
					}
					
					var networkid = gsm["network-id"];
					if(!isArray(networkid)){
						networkid = new Array(networkid);
					}
					
					var mcc,mnc;
					if(!!!networkid){
						mcc = '';
						mnc = '';
						for(var k=0;k<apns.length;k++){
							
							$(".container").append(mcc
									+"|"
									+mnc
									+"|"
									+apns[k]["-value"]
									+"|"
									+ct+"/"+pnm);
							$(".container").append('<br>');
							/**console.log(mcc
									+"|"
									+mnc
									+"|"
									+apns[k]["-value"]
									+"|"
									+ct+"/"+provideres[j].name);*/
						}
					} else if(!!!apns){
						for(var l=0;l<networkid.length;l++){
							mcc = networkid[l]["-mcc"];
							mnc = networkid[l]["-mnc"];
							
							$(".container").append(mcc
									+"|"
									+mnc
									+"|"
									+
									+"|");
							$(".container").append('<br>');
							/**console.log(mcc
									+"|"
									+mnc
									+"|"
									+
									+"|");*/
						}
					}else {
						var alen = apns.length;
						var nlen = networkid.length;
						
						var maxlen;
						if(alen <= nlen){
							maxlen = nlen;
						} else {
							maxlen = alen;
						}
						for(var l=0;l<maxlen;l++){
							if(!!!networkid[l]){
								mcc = '';
								mnc = '';
							} else {
								mcc = networkid[l]["-mcc"];
								mnc = networkid[l]["-mnc"];
							}
							
							var aval,cnm;
							if(!!!apns[l]){
								aval = '';
								cnm = '';
							} else {
								aval = apns[l]["-value"];
								cnm = ct+"/"+pnm
							}
							$(".container").append(mcc
									+"|"
									+mnc
									+"|"
									+aval
									+"|"
									+cnm);
							$(".container").append('<br>');
							/**console.log(mcc
									+"|"
									+mnc
									+"|"
									+aval
									+"|"
									+cnm);
							*/
						}
					}
				}
				//console.log("\n");
			};
		});
	</script>
</body>
